global ranNum,thePass,howManyTimes,howManyLetters,theCounter,theLetters
put "" into card field "thePassList"
ask "How many passwords should be generated?" with 50
if the result is "Cancel" or it = 0 then exit mouseUp
put it into howManyTimes
ask "How many letters per password?" with 8
if the result is "Cancel" or it = 0 then exit mouseUp
put it into howManyLetters
if (howManyTimes*howManyLetters)>29996 then
answer "The amount of passwords you have specified exceeds the allowable" & " limit. Not all of them will be generated. Do you still wish to continue?" with "Yes" or "No"
if it is "No" then exit mouseUp
end if
put 0 into theCounter
put 0 into theLetters
repeat howManyTimes
put "" into thePass
put 0 into theLetters
repeat while theLetters<howManyLetters
put random(74)+48 into ranNum
if ranNum<58 or ranNum>64 and ranNum<91 or ranNum>96 then
put numToChar(ranNum) after thePass
add 1 to theLetters
set cursor to busy
end if
end repeat
put thePass & return after card field "thePassList"
if theLetters=howManyLetters then add 1 to theCounter
put "Processing: " & theCounter &"/" & howManyTimes into card field "Status"
if length (card field "thePassList")>(29996-howManyLetters) then
answer "The field is full. Only " & theCounter & " passwords were generated." with "Sorry"
exit mouseup
end if
end repeat
put "Processing: Done" into card field "Status"
end mouseUp
-- part 3 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=0 top=50 right=99 bottom=124
-- title width / last selected line: 0
-- icon id / first selected line: 129 / 129
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Export…
----- HyperTalk script -----
on mouseUp
global aNumber,theListIsEmpty,theLength
put 1 into aNumber
put "true" into theListIsEmpty
put length(card field "thePassList") into theLength
repeat theLength
if theListIsEmpty="false" then exit repeat
put charToNum(character aNumber of card field "thePassList") into theCharacter
if theCharacter>32 and theCharacter≠127 and theCharacter≠202 then
put "false" into theListIsEmpty
end if
add 1 to aNumber
end repeat
if theListIsEmpty="false" then
ask file "Create a password file:" with "PasswordList"
if the result is "Cancel" or it is empty then exit mouseUp
put it into fileName
open file fileName
write card field "thePassList" to file fileName
close file fileName
else
answer "There is nothing to export." with "Sorry"
end if
end mouseUp
-- part 4 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=0 top=98 right=149 bottom=124
-- title width / last selected line: 0
-- icon id / first selected line: 130 / 130
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: About…
----- HyperTalk script -----
on mouseUp
put "Random Password Generator (HC)" & return after answerString